<HTML>
<HEAD>
<TITLE>Getting started - Water</TITLE>
<LINK rel=stylesheet href="style.css" type="text/css">
<BODY text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990000" alink="#FF0000">
<TABLE WIDTH="98%" NOBORDER >
<TR><TD WIDTH=400>
<TABLE WIDTH=400 NOBORDER>
<TD WIDTH=116>
<a href="http://www.gromacs.org/"><img SRC="../images/gmxlogo_small.jpg"BORDER=0 height=133 width=116></a></td>
<td ALIGN=LEFT VALIGN=TOP WIDTH=280><br><h2>Getting started - Water</h2>
<font size=-1><A HREF="../online.html">Main Table of Contents</A></font><br><br></td>
</TABLE></TD><TD WIDTH="*" ALIGN=RIGHT VALIGN=BOTTOM><p><B>VERSION 4.0<br>
Sun 18 Jan 2009</B></td></tr></TABLE>
<HR>

<P><H2><A NAME="water">Water</A></H2>
Now you are going to simulate 216 molecules of SPC water 
(<A HREF="getting_started.html#berendsen81">Berendsen <it>et al.</it>, 1981</A>)
in a cubic box. In this example the GROMACS
software team already generated most of the neccesary input
files. The files needed in this example are:
<ul>
<LI> Initial structure of a box of 216 water molecules (<TT><a href="gro.html">.gro</a></TT>)</li>

<LI> Topology file of water (<tt><a href="top.html">.top</a></tt>)</li>
<LI> Molecular Dynamics parameter file (<TT><a href="mdp_opt.html">.mdp</a></TT>)</li>
</ul>
<P>
Change your directory to <tt>tutor/water </tt>:   
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> cd tutor/water</tt>
<td></td>
</tr>
</table>
<br>
Let's first have a look at the coordinate file:
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  more conf.gro
</tt>
<td></td>
</tr>
</table>
<br>
Or to view the water box graphically:
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  rasmol spc216.pdb
</tt>
<td></td>
</tr>
</table>
<br>

Have a look at the topology file:
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  more topol.top
</tt>
<td></td>
</tr>
</table>
<br>

Have a look at the <a href="mdp_opt.html">MD-parameters file</a>:
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  more grompp.mdp
</tt>
<td></td>
</tr>
</table>
<br>

Since all the neccesary files are available, we are going to
preprocess the input files to create a run input 
(<TT><a href="tpr.html">.tpr</a></TT>) file. 
This run input file is the only input file for the
MD-program <TT><a href="mdrun.html">mdrun</a></TT>. 
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  grompp -v
</tt>
<td></td>
</tr>
</table>
<br>

The run input file is only viewable with the program 
<TT><a href="gmxdump.html">gmxdump</a></TT>. 
In this way it is possible to check if the  preprocessor 
<TT><a href="grompp.html">grompp</a></TT> worked well.
The output may seem rather cryptic, so don't panic when you don't
understand every single item in it.
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt>  gmxdump -s topol.tpr | more
</tt>
<td></td>
</tr>
</table>
<br>

Now it's time to start the simulation of 20 picoseconds.
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> mdrun -v
</tt>
<td></td>
</tr>
</table>
<br>

After the MD simulation is finished, it is possible to view the
trajectory with the <a href="ngmx.html">ngmx</a> program:
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> ngmx
</tt>
<td></td>
</tr>
</table>
<br>

<P>
When the program starts, you must select a group of atoms to view. In
our case that will be "SOL" (for solvent) or "System", which is the
same for a box of water as we have. Select one and click OK. Then
select Display->Animate from the menu. Use the buttons to see your
water moving (note: "Play" steps one frame forward; "Fast Forward"
plays; "Rewind" skips back to the beginning of the trajectory).
</P>

<hr>
<h2>Analysis of the simulation</h2>
<ol>
<li><p>
Calculate a radial distribution function of the Oxygen atoms. The
index file <TT><a href="ndx.html">index.ndx</a></TT> 
contains one group with all the oxygen atoms. 
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> g_rdf -n index
</tt>
<td></td>
</tr>
</table>
<br>
The program will ask you for how many groups you want the calculate
the RDF, answer 1. Now,
view the output graph of <TT><a href="g_rdf.html">g_rdf</a></TT>.
The file is already prepared to produce a nice graph in the 
<tt>xmgrace</tt> program.
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> xmgrace rdf.xvg 
</tt>
<td></td>
</tr>
</table>
<br>
Which shows you the radial distribution function for Oxygen-Oxygen in
SPC water. The first peak is at roughly 0.28 nm, and has a height of 2.8.
This means that the relative density of oxygen atoms in water, 
is almost 3 times higher at a distance of 0.28 nm from another oxygen atom.
Obviously this is due to strong hydrogen bonding in liquid water.
</P></li>

<li><p>
We can also do a direct analysis of the number of hydrogen bonds in
liquid water, based on O-O distance and O-H ... O angle.
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> g_hbond
</tt>
<td></td>
</tr>
</table>
<br>
Select twice 0, when asked. Check the output with 
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> xmgrace hbnum.xvg 
</tt>
<td></td>
</tr>
</table>
<br>
<font color="red">What is the number of hydrogen bonds per water
molecule? What is the maximum possible number?</font>
</p></li>

<li><p>
As a further test of the simulation we will compute the self diffusion constant
of water. This can be computed from the <b>Mean square displacement</b> (MSD)
function. The MSD determines how much on average a molecule has moved 
with time. After a certain time period there is no correlation between the
starting position and the current position and the square displacement will
be linear with time. The slope of the MSD function is the linearly proportional
to the self diffusion constant.
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> g_msd -n index
</tt>
<td></td>
</tr>
</table>
<br>
View the output
<br><br>
<table BORDER=0 CELLSPACING=0 CELLPADDING=8 COLS=3 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="2%" NOSAVE><font color="#000000"></font></td>
<td WIDTH="80%" BGCOLOR="#000066" NOSAVE><font color="#FFFFFF">

<tt> xmgrace msd.xvg 
</tt>
<td></td>
</tr>
</table>
<br>
Check that the graph is roughly linear. The <tt>g_msd</tt> program also
computes the diffusion constant D for you. The experimental value
is roughly 2.3 x 10<sup>-5</sup> cm<sup>2</sup>/s. The simulation
result is clearly too high, due to the simplicity of the model.
</p></li>
</ol>

<hr>
<a href="methanol.html"><h3>Go to the next step</h3></a>
<hr>

</BODY>
</HTML>
